Component({
  data: {
    selected: 0,
    "color": "#666",
    "selectedColor": "#9e060b",
    "list": [{
      "pagePath": "/pages/home/home",
      "text": "首页",
      "iconPath": "/assets/images/ic_menu_choice_nor.png",
      "selectedIconPath": "/assets/images/ic_menu_choice_pressed.png"
    }, {
      "pagePath": "/pages/topic/topic",
      "text": "专题",
      "iconPath": "/assets/images/ic_menu_topic_nor.png",
      "selectedIconPath": "/assets/images/ic_menu_topic_pressed.png"
    }, {
      "pagePath": "/pages/classify/classify",
      "text": "分类",
      "iconPath": "/assets/images/ic_menu_sort_nor.png",
      "selectedIconPath": "/assets/images/ic_menu_sort_pressed.png"
    }, {
      "pagePath": "/pages/cart/cart",
      "text": "购物车",
      "iconPath": "/assets/images/ic_menu_shoping_nor.png",
      "selectedIconPath": "/assets/images/ic_menu_shoping_pressed.png"
    }, {
      "pagePath": "/pages/mine/mine",
      "text": "我的",
      "iconPath": "/assets/images/ic_menu_me_nor.png",
      "selectedIconPath": "/assets/images/ic_menu_me_pressed.png"
    }]
  },
  attached() {
  },
  methods: {
    switchTab(e) {
      const data = e.currentTarget.dataset
      const url = data.path
      wx.switchTab({ url }) //跳转到 tabBar 页面，并关闭其他所有非 tabBar 页面
      this.setData({
        selected: data.index
      })
    }
  }
})